package task_synchronization

import (
	"context"
	"testing"

	"v8s-controller/test/support"
)

func Test(t *testing.T, ctx *support.ApplicationContext, folder string) {
	// Arrange:
	ctx.MongoHelper.InsertProjects("task-synchronization/" + folder + "/fixture-mongodb.json")
	ctx.K8SHelper.InsertData("task-synchronization/" + folder + "/fixture-k8s.yaml")

	// Act:
	err := ctx.ProjectsController.Execute(context.Background())
	if err != nil {
		t.Fatalf("failed to execute test: %s", err)
	}

	// Assert:
	ctx.MongoHelper.AssertProjects(t, "task-synchronization/"+folder+"/expected-mongodb.json")
	ctx.K8SHelper.AssertResources(t, "task-synchronization/"+folder+"/expected-k8s.yaml")
}
